﻿@model ViewPostModel
@using LastoRevival.Service.Contracts.Models;

@{
	var canModerate = ((UserProfile)ViewBag.UserProfile).CanModerate(Model.ForumID);
}

<div id="post-details">
	<span id="subject">@Model.Subject</span>
	<span id="author"><label>@LanguageLoader.GetWord("AuthoredByLabel")</label>
		@if (Model.UserID != UserProfileDetails.AnonymousUserID)
		{
			<a class="author @Model.GroupName" href="@Url.Action("ViewUser", "User", new { username = Model.UserName })"> @Model.UserName</a>
		}
		else
		{		
			<span class="author @Model.GroupName">@Model.UserName</span>
		}
	</span>
	<span id="author-post-count">@Model.AuthorPostCount</span>
	<span id="timestamp"><label>@LanguageLoader.GetWord("PostDateLabel")</label>@Model.DatePosted.ToString(LanguageLoader.GetWord("TimestampFormat"))</span>
	<span id="client"><label>Client:</label>@Model.Client</span>
	<span id="ip"><label>IP:</label>@Model.IP</span>
	<span id="views"><label>Message views:</label>@Model.Views</span>
	<span id="score">@string.Format(LanguageLoader.GetWord("PostScoreFormat"), 0)</span>
	@if (Model.CanEdit)
	{
		<span id="edit-post"><a href="@Url.Action("EditForm", new { Model.PostID })">@LanguageLoader.GetWord("EditPost")</a></span>
	}
	@if (canModerate)
	{
		<span id="mod-controls">
			@if (Model.Locked)
			{
				<a id="lock-post" href="@Url.Action("UnlockPost", "Admin", new { postID = Model.PostID })">@LanguageLoader.GetWord("UnlockPost")</a>
			}
			else
			{
				<a id="lock-post" href="@Url.Action("LockPost", "Admin", new { postID = Model.PostID })">@LanguageLoader.GetWord("LockPost")</a>
			}
		</span>
	}

	<div id="body">
		@Html.Raw(Model.Body)
	</div>
</div>